package com.euond.permission.mapper;

import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import com.euond.common.core.dao.BaseEuondMapper;
import com.euond.permission.entities.Menu;
import com.euond.permission.entities.Resource;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * Created by Daniel on 18/06/2017.
 * Menu Dao
 */
@Mapper
public interface MenuMapper extends BaseEuondMapper<Menu> {

    /**
     * 查询用户指定工程的菜单（用户权限过滤）
     *
     * @param projectId
     * @param companyId
     * @param userId
     * @return
     */
    List<Menu> findUserMenus(@Param("projectId") Long projectId, @Param("companyId") Long companyId, @Param("userId") Long userId);

    /**
     * 查询用户指定工程的菜单(无需用户权限过滤)
     *
     * @param projectId
     * @param companyId
     * @return
     */
    List<Menu> findUserMenusNoPermission(@Param("projectId") Long projectId, @Param("companyId") Long companyId);


    /**
     * 按项目查找未分配菜单的资源
     * @param
     * @return
     */
    List<Resource> findNotAllotMenuResources(Pagination page, Menu menu);

}
